/**
 * 挨个减，再判断即可
 */
#include <bits/stdc++.h>
using namespace std;

int N, M;

void work(){
    cin >> N >> M;
    int ans = -1;
    for(int a,i=1;i<=N;++i){
        cin >> a;
        if(ans == -1){
            M -= a;
            if(M < 0){
                ans = i - 1;
            }            
        }
    }
    cout << (ans == -1 ? N : ans) << endl;
    return;
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int nofkase = 1;
    // cin >> nofkase; 
    while(nofkase--) work();
    return 0;
}